#!/usr/bin/env python

# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

""" Temporary access token class """

from streetidentity_rp.error import DataError

__author__ = "Maciej Machulak"
__maintainer__ = "Maciej Machulak"
__email__ = "mmachulak@google.com"

__copyright__ = "Copyright 2012 Google Inc. All Rights Reserved."
__license__ = "Apache License 2.0"
__version__ = "0.2"
__status__ = "Prototype"


class AccessToken(object):
    """Represents the Access Token for the Attribute object."""

    def __init__(self, access_token_dict):
        if not isinstance(access_token_dict, dict):
            raise DataError('invalid format')
        super(AccessToken, self).__init__()
        self.access_token = access_token_dict.get('token', None)

    def __str__(self):
        return 'access token: ' + self.access_token
